home *** CD-ROM | disk | FTP | other *** search
- *** AMORT.PRO
- *** by Morris Pyle 02/03/85
-
- PROCEDURE amort
- SET TALK OFF
- *** Ensure that the User has selected the correct program.
- STORE .T. TO contin
- CLEAR
- @ 8, 5 SAY "This program prints Loan Amortization schedules. "
- @ 10, 5 SAY "Is this the program you wish to run? (T/F) " GET contin
- READ
- IF .NOT. contin
- SET TALK ON
- RETURN
- ENDIF
-
- *** Initiate the variables needed.
- PUBLIC loan_amt, int_rate, loan_pmt
- STORE CTOD(" / / ") TO mdate
- STORE " " TO filler
- STORE .T. TO run
- STORE mdate TO pmtdate
- STORE mdate TO lsdate
- STORE .F. TO first
- STORE SPACE(25) TO name
- STORE 0.00 TO loan_amt
- STORE 0.00 TO loan_pmt
- STORE 0.00 TO int_rate
- STORE 0 TO term
- STORE .F. TO showb
- STORE .F. TO figure
-
- *** Find out if the User wishes the Computer to figure the Mo. Payments.
- CLEAR
- @ 10, 5 SAY 'Do you wish the Computer to figure the Monthly Payments? ;
- (T/F) ' GET figure
- READ
- IF figure
- DO pmnt
- ENDIF
-
- *** Set up the Loop to get the User's input.
- DO WHILE .T.
- CLEAR
- STORE .T. TO keepon
- @ 1, 5 SAY "*** AMORTIZATION OF SIMPLE INTEREST MONTHLY PAYMENT ;
- LOAN ***"
- @ 3, 5 SAY "Who is this Schedule for, please? " GET name ;
- PICTURE '!!!!!!!!!!!!!!!!!!!!!!!!!'
- @ 5, 5 SAY "What is the Loan Amount, please? " GET loan_amt ;
- PICTURE '999999.99'
- @ 7, 5 SAY "What is the Interest Rate, please? " GET int_rate ;
- PICTURE '99.99'
- @ 9, 5 SAY "What is the Monthly PI Payment Amount, please? " GET ;
- loan_pmt PICTURE '9999.99'
- @ 11, 5 SAY "What is the date of the First Payment, please? " GET ;
- pmtdate
- @ 12, 5 SAY "(Avoid using dates that do NOT recur every ;
- month, such as 29, 30, 31)"
- @ 14, 5 SAY "Is the First Payment for a period of other than one ;
- month? (T/F) " GET first
- READ
- IF first
- @ 16, 5 SAY "What is the date the loan starts? " GET lsdate
- @ 18, 5 SAY "What is the Number of months for which you want this ;
- schedule? " GET term PICTURE '999'
- @ 20, 5 SAY "Show any Loan Balance at End of Schedule as a Balloon ;
- Payment? (T/F) " GET showb
- ELSE
- STORE pmtdate - 28 TO lsdate
- IF DAY(lsdate) > DAY(pmtdate)
- STORE lsdate - (DAY(lsdate) -DAY(pmtdate)) TO lsdate
- ENDIF
- @ 16, 5 SAY "What is the Number of months for which you want this ;
- schedule? " GET term PICTURE '999'
- @ 18, 5 SAY "Show any Loan Balance at End of Schedule as a Balloon ;
- Payment? (T/F) " GET showb
- ENDIF
- READ
- @ 22, 5 SAY "Are all answers Correct? (T/F) " GET keepon
- READ
- CLEAR GETS
- IF .NOT. keepon
- LOOP
- ELSE
- EXIT
- ENDIF
- ENDDO
- *** Ensure that the printer is on and ready.
- CLEAR
- @ 8, 5 SAY "Please be sure your Printer is On and Ready To Print at ;
- this time."
- ?
- ACCEPT "Enter Carriage Return (Cr.) when ready to proceed. " TO print
- *** Execute the program.
- CLEAR
- @ 10,10 SAY "Program Processing.... Please Wait."
- USE amort
- APPEND BLANK
- REPLACE payment WITH loan_pmt
- IF first
- REPLACE interest WITH ((int_rate/100)/365 * (pmtdate -lsdate)) * loan_amt
- ELSE
- REPLACE interest WITH (int_rate/100)/12 * loan_amt
- ENDIF
- REPLACE principal WITH payment - interest
- REPLACE balance WITH loan_amt - principal
- REPLACE date WITH pmtdate
- STORE balance TO obalance
- STORE pmtdate TO opmtdate
- SKIP
- DO WHILE RECNO() <= term .AND. obalance > 0
- APPEND BLANK
- REPLACE interest WITH (int_rate/100)/12 * obalance
- IF interest + obalance > loan_pmt
- REPLACE payment WITH loan_pmt
- ELSE
- REPLACE payment WITH interest + obalance
- ENDIF
- REPLACE principal WITH payment - interest
- REPLACE balance WITH obalance - principal
- STORE opmtdate + 31 TO npmtdate
- IF DAY(npmtdate) > DAY(opmtdate)
- STORE npmtdate - (DAY(npmtdate) -DAY(opmtdate)) TO npmtdate
- ENDIF
- REPLACE date WITH npmtdate
- STORE balance TO obalance
- STORE npmtdate TO opmtdate
- SKIP
- ENDDO
- IF showb .AND. obalance > 0
- APPEND BLANK
- REPLACE payment WITH obalance
- REPLACE principal WITH obalance
- REPLACE interest WITH 0
- REPLACE date WITH npmtdate
- ENDIF
-
- *** Set up variables for and run the schedule(s).
- STORE DTOC(lsdate) TO lsdate1
- STORE STR(loan_amt,9,2) TO loanamt
- STORE STR(int_rate,5,2) TO intrate
- DO WHILE .T.
- CLEAR
- REPORT FORM amort HEADING ' *** $&loanamt &name Loan on &lsdate1 at ;
- &intrate.%' NOEJECT TO PRINT
- EJECT
- CLEAR
- @ 10, 5 SAY "Do you wish another copy of this schedule? (T/F) " GET run
- READ
- IF run
- LOOP
- ELSE
- EXIT
- ENDIF
- ENDDO
-
- *** Clear the files and screen and Return.
- ZAP
- USE
- CLEAR
- SET TALK ON
- RETURN
- *** EOF amort
-
-
- PROCEDURE pmnt
- STORE 12 TO pmts
- STORE 0.00 TO prin
- STORE 0.00 TO i
- STORE 0 TO mos
- STORE .F. TO another
- DO WHILE .T.
- CLEAR
- @ 4,13 SAY '*** PROGRAM TO FIGURE MONTHLY PAYMENTS ON A LOAN ***'
- @ 6,15 SAY 'What is Principal Amount of the Loan? ' GET prin ;
- PICTURE '999999.99'
- @ 8,15 SAY 'What is the Interest Rate on the Loan? ' GET i ;
- PICTURE '99.99'
- @ 10,15 SAY 'How many Months for Payment Amortization? ' GET mos ;
- PICTURE '999'
- @ 11,17 SAY '(30 yrs = 360 mos., 25 yrs = 300 mos.)'
- READ
- STORE mos/12 TO yrs
- STORE ((i/100)*prin/pmts)/(1-1/((i/100)/pmts+1)^(pmts*yrs)) TO pmnt
- @ 13,19 SAY 'The Payment is $'
- @ 13,35 SAY ROUND(pmnt,2) PICTURE '9999.99'
- @ 13,43 SAY 'Per Month!'
- @ 15,15 SAY 'Do you wish to figure another payment? (T/F) ' GET another
- READ
- IF another
- LOOP
- ELSE
- EXIT
- ENDIF
- ENDDO
- STORE pmnt TO loan_pmt
- STORE i TO int_rate
- STORE prin TO loan_amt
- RETURN
- *** EOF pmnt
-
- *** EOF amort.pro